<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/common/taglibs.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
<%@ include file="/WEB-INF/views/common/meta.jsp"%>

<title>学生作业系统-登录</title>

<!--EasyUI-->
<link rel="stylesheet" href="${ctx}/static/easyui-1.5.1/css/easyui.css">
<link rel="stylesheet" href="${ctx}/static/easyui-1.5.1/css/icon.css">
<!--Login css-->
<link rel="stylesheet" href="${ctx}/static/css/login/login.css">

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script type="text/javascript"
	src="${ctx}/static/jquery/jquery-1.9.1.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="${ctx}/static/easyui-1.5.1/jquery.easyui.min.js"></script>
<!--Login js-->
<script type="text/javascript" src="${ctx}/static/js/login/login.js"></script>



</head>
<body>

	<div>
		<div class="easyui-panel" title="请登录" style="width: 360px">
			<div style="padding: 10px 60px 20px 60px">
				<form id="loginfrom" method="post">
					<table cellpadding="5">
						<tr>
							<td>用户名:</td>
							<td><input class="easyui-textbox" type="text" style="width: 145px" id="username"
								name="username" data-options="required:true"></input></td>
						</tr>
						<tr>
							<td>密码:</td>
							<td><input class="easyui-textbox" type="password" style="width: 145px"
								name="password" data-options="required:true"></input></td>
						</tr>
					</table>
				</form>
				<div style="text-align: center; padding: 5px">
					<a href="javascript:void(0)" class="easyui-linkbutton"
						onclick="submit()">登录</a> <a href="javascript:void(0)"
						class="easyui-linkbutton" onclick="regist()">注册</a>
				</div>
			</div>
		</div>

	</div>

	<script>
		function submit() {
			alert($("loginfrom").serialize());
			$.ajax({
	            type: "POST",
	            url: ctx+"/login/doLogin",
	            data: $("loginfrom").serialize(),
	            dataType: "json",
	            success: function(data){
	            	if(data.statusCode==1){
	            		window.location.href = ctx+"/login/gotoMain";
	            	}else{
	            		alert(data.message)
	            	}
	            }
	        });
		}
		
		function regist() {
			alert("regist");
		}
	</script>

</body>
</html>